package com.white.webserver.util;

public class PasswordUtils
{
    public enum PasswordStrength
    {
        LOW, MIDDLE, HIGH;
    }

    public static PasswordStrength checkPassword(String passwordStr) {
        String regexZ = "\\d*";
        String regexS = "[a-zA-Z]+";
        String regexT = "\\W+$";
        String regexZT = "\\D*";
        String regexST = "[\\d\\W]*";
        String regexZS = "\\w*";
        String regexZST = "[\\w\\W]*";

        if (passwordStr.matches(regexZ) || passwordStr.matches(regexS) || passwordStr.matches(regexT)) {
            return PasswordStrength.LOW;
        }
        if (passwordStr.matches(regexZT) || passwordStr.matches(regexST) || passwordStr.matches(regexZS)) {
            return PasswordStrength.MIDDLE;
        }
        if (passwordStr.matches(regexZST)) {
            return PasswordStrength.HIGH;
        }
        return PasswordStrength.LOW;

    }
}
